package compiler.parse;

public class TestLexer {
	  public static void main(String argv[]) {
		    if (argv.length == 0) {
		      System.out.println("Usage : java TestLexer <inputfile>");
		    }
		    else {
		      System.out.println(argv.length);
		      for (int i = 0; i < argv.length; i++) {
		        Yylex scanner = null;
		        try {
		          scanner = new Yylex( new java.io.FileReader(argv[i]) );
		          java_cup.runtime.Symbol symbol;
		          do{
		        	  symbol = scanner.debug_next_token();
		          }
		          while( symbol.sym != sym.EOF );
		        }
		        catch (java.io.FileNotFoundException e) {
		          System.out.println("File not found : \""+argv[i]+"\"");
		        }
		        catch (java.io.IOException e) {
		          System.out.println("IO error scanning file \""+argv[i]+"\"");
		          System.out.println(e);
		        }
		        catch (Exception e) {
		          System.out.println("Unexpected exception:");
		          e.printStackTrace();
		        }
		      }
		    }
		  }

}
